package com.sunni.converter;

import com.sunni.entity.Adress;
import com.sunni.entity.User;
import org.springframework.core.convert.converter.Converter;

public class UserConverter implements Converter<String , User> {
    @Override
    public User convert(String s) {
        String[] args = s.split("-");
        User user = new User();
        user.setId(Integer.parseInt(args[0]));
        user.setName(args[1]);
        user.setAdress(new Adress(Integer.parseInt(args[2]),args[3]));
        return user;
    }
}
